/*
 * @Author: wangtao
 * @Date: 2021-01-14 16:00:34
 * @LastEditors: 汪滔
 * @LastEditTime: 2021-02-01 16:44:37
 * @Description: file content
 */
import React, { Component, Fragment, PureComponent } from 'react';
import {
  TouchableOpacity,
  StyleSheet,
  View,
  Text,
  Image,
  Dimensions,
  BackHandler,
  SafeAreaView,
  NativeModules,
  DeviceEventEmitter,
  NativeEventEmitter,
  TextInput,
  ScrollView,
  PixelRatio,
} from 'react-native';
import {
  px2dp,
  screenWidth,
  isAndroid,
  mainBgColorLightGray,
  mainBgColorWhite,
  fontColorBlack,
  fontColorCoffee,
  fontColorLightGray,
  splitLineColorLightGray,
} from '../../../../../common/styles/index';
import { Button, msg, Header, _, BackImage } from '../../../../../common';
import { iconPositionCoffee, iconTime } from '../../../../../image';

export default class AddressSearchList extends PureComponent {
  componentDidMount() {}

  componentWillUnmount() {}

  render() {
    const { addressInfo, selectItem, type } = this.props;
    return (
      <TouchableOpacity style={styles.item} activeOpacity={0.8} onPress={() => selectItem(addressInfo)}>
        <View style={styles.itemLeft}>
          <Image
            source={type == 'history' ? iconTime : iconPositionCoffee}
            style={styles.iconPositionImg}
            resizeMode='stretch'
          />
        </View>
        <View style={styles.itemRight}>
          <Text style={styles.title}>{addressInfo.street}</Text>
          <Text style={styles.desc}>{addressInfo.name}</Text>
        </View>
      </TouchableOpacity>
    );
  }
}
const styles = StyleSheet.create({
  item: {
    backgroundColor: mainBgColorWhite,
    height: px2dp(138),
    flexDirection: 'row'
  },
  iconPositionImg: {
    width: px2dp(40),
    height: px2dp(40),
  },
  itemLeft: {
    width: px2dp(96),
    height: '100%',
    alignItems: 'center',
    justifyContent: 'center'
  },
  itemRight: {
    flex: 1,
    justifyContent: 'center',
    borderBottomColor: splitLineColorLightGray,
    borderBottomWidth: 1 / PixelRatio.get()
  },
  title: {
    fontSize: px2dp(32),
    color: fontColorBlack
  },
  name: {
    fontSize: px2dp(26),
    color: fontColorLightGray
  },

});
